using System;
using System.Diagnostics.Contracts;

namespace Charisma
{
    [ContractClass(typeof (IMetaDataProviderContract))]
    public interface IMetaDataProvider
    {
        MetaType GetMetaType<T>();

        MetaType GetMetaType(Type type);
    }

    [ContractClassFor(typeof (IMetaDataProvider))]
    internal abstract class IMetaDataProviderContract : IMetaDataProvider
    {
        #region IMetaDataProvider Members

        public MetaType GetMetaType<T>()
        {
            Contract.Requires(!typeof (T).IsGenericTypeDefinition);
            Contract.Requires(!typeof (T).IsGenericParameter);
            Contract.Ensures(Contract.Result<MetaType>() != null);
            return null;
        }

        public MetaType GetMetaType(Type type)
        {
            Contract.Requires(type != null);
            Contract.Requires(!type.IsGenericTypeDefinition);
            Contract.Requires(!type.IsGenericParameter);
            Contract.Ensures(Contract.Result<MetaType>() != null);
            return null;
        }

        #endregion
    }
}